using System;
using System.Collections.Generic;
using System.Text;
using AF_ORM.CORE;
using System.Data;
using AF_ORM.CORE;
using System.Data;
using System.Data.SqlClient;

namespace Bussiness.Manager
{
                

    public class CmsNewsInfosManager:Bussiness.ManagerBase.CmsNewsInfosManagerBase
    {
            public static CmsNewsInfosManager CreateInstant()
            {
                return new CmsNewsInfosManager();
            }

            public DataTable getNewsDetail(Guid IdNewsInf)
            {
                string sql = "select * from viewNews where Id_vn = '" + IdNewsInf + "'";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString,CommandType.Text,sql);
            }

            public DataTable getNewsDetailByIntId(int IntId)
            {
                string sql = "select * from viewNews where IntId = '" + IntId + "'";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString, CommandType.Text, sql);
            }

            public DataTable getCatIntIdByNewsIntId(int IntIdNews)
            {
                string sql = "select N.*,C.IntId as IntIdCat from viewNews N inner join viewNewsCategory C on N.CategoryId = C.Id where N.IntId = '" + IntIdNews + "'";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString, CommandType.Text,sql);
            }


            public DataTable getCatIntIdByProIntId(int IntIdPro)
            {
                string sql = "select P.*,C.IntId as IntIdCat from viewProduct P inner join viewProductCategory C on P.CategoryId = C.Id_vn where P.IntId = '" + IntIdPro + "'";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString, CommandType.Text, sql);
            }

    }
}
                    
